API Documentation for: 1.1.23
Show:

DragManager (PIXI) Class

Defined in: DragManager (PIXI):8
Namespace: cloudkid

Drag manager is responsible for handling the dragging of stage elements supports click-n-stick and click-n-drag functionality.

Constructor

DragManager (PIXI)

(
  • startCallback
  • endCallback
)

Parameters:

  • startCallback Function

    The callback when when starting

  • endCallback Function

    The callback when ending

Methods

_handlePointSnap

(
  • localMousePos
)
private

Handles snapping the dragged object to the nearest among a list of points

Parameters:

  • localMousePos createjs.Point

    The mouse position in the same space as the dragged object.

_objMouseDown

(
  • type
  • object
)
private

Defined in _objMouseDown:211

Mouse down on an obmect

Parameters:

  • type Int

    The type of input that triggered this call - either TYPE_MOUSE or TYPE_TOUCH.

  • object PIXI.DisplayObject

    The object that should be dragged.

_startDrag

() private

Defined in _startDrag:285

Internal start dragging on the stage

_stopDrag

(
  • ev
  • doCallback
)
private

Defined in _stopDrag:310

Internal stop dragging on the stage

Parameters:

  • ev Event

    Mouse up event

  • doCallback Bool

    If we should do the callback

_triggerHeldDrag

(
  • interactionData
)
private

Start hold dragging

Parameters:

  • interactionData PIXI.InteractionData

    The ineraction data about the moved mouse

_triggerStickyClick

() private

Start the sticky click

_updateObjPosition

(
  • interactionData
)
private

Update the object position based on the mouse

Parameters:

  • interactionData PIXI.InteractionData

    Mouse move event

addObject

(
  • obj
  • bound
)
public

Defined in addObject:438

Adds properties and functions to the object - use enableDrag() and disableDrag() on objects to enable/disable them (they start out disabled). Properties added to objects: _dragBounds (Rectangle), _onMouseDownListener (Function), _dragMan (cloudkid.DragManager) reference to the DragManager these will override any existing properties of the same name

Parameters:

  • obj PIXI.DisplayObject

    The display object

  • bound PIXI.Rectangle

    The rectangle bounds

destroy

() public

Defined in destroy:493

Destroy the manager

initialize

(
  • startCallback
  • endCallback
)

Defined in initialize:177

Constructor

Parameters:

  • startCallback Function

    The callback when when starting

  • endCallback Function

    The callback when ending

removeObject

(
  • obj
)
public

Defined in removeObject:471

Removes properties and functions added by addObject().

Parameters:

  • obj PIXI.DisplayObject

    The display object

startDrag

(
  • object
  • interactionData
)
public

Defined in startDrag:198

Manually starts dragging an object. If a mouse down event is not supplied as the second argument, it defaults to a held drag, that ends as soon as the mouse is released.

Parameters:

  • object PIXI.DisplayObject

    The object that should be dragged.

  • interactionData PIXI.InteractionData

    The interaction data about the input event that triggered this.

stopDrag

(
  • doCallback
)
public

Defined in stopDrag:299

Stops dragging the currently dragged object.

Parameters:

  • doCallback Bool

    If the drag end callback should be called. Default is false.

Properties

_dragEndCallback

Function private

External callback when we are done dragging

_draggableObjects

Array private

The collection of draggable objects

_dragOffset

PIXI.Point private

Defined in _dragOffset:116

The local to global position of the drag

_dragStartCallback

Function private

External callback when we start dragging

_stageMouseUpCallback

Function private

Callback when we are done with the drag

_theStage

PIXI.Stage private

Defined in _theStage:109

Reference to the stage

_triggerHeldDragCallback

Function private

Callback to test for the start a held drag

_triggerStickyClickCallback

Function private

Callback to start a sticky click drag

_updateCallback

Function private

Defined in _updateCallback:158

The function call when the mouse/touch moves

allowStickyClick

Bool public

Defined in allowStickyClick:82

If sticky click dragging is allowed.

Default: true

draggedObj

PIXI.DisplayObject public

Defined in draggedObj:25

The object that's being dragged

dragStartThreshold

Unknown public

The radius in pixel to allow for dragging, or else does sticky click

Default: 20

isHeldDrag

Bool public

Defined in isHeldDrag:64

Is the drag being held on mouse down (not sticky clicking)

Default: false

isStickyClick

Bool public

Defined in isStickyClick:73

Is the drag a sticky clicking (click on a item, then mouse the mouse)

Default: false

isTouchMove

Bool public

Defined in isTouchMove:55

Is the move touch based

Default: false

mouseDownObjPos

PIXI.Point private

Defined in mouseDownObjPos:48

The position x, y of the object when interaction with it started.

mouseDownStagePos

PIXI.Point private

The position x, y of the mouse down on the stage

snapSettings

Object public

Defined in snapSettings:90

Settings for snapping.

Format for snapping to a list of points: { mode:"points", dist:20,//snap when within 20 pixels/units points:[ { x: 20, y:30 }, { x: 50, y:10 } ] }

Default: null